package com.hntxk.cqzd.pacs.action;


import com.hntxk.cqzd.common.action.CqzdBaseController;
import com.hntxk.cqzd.pacs.model.PacsModel;
import com.hntxk.cqzd.pacs.service.PacsInterfaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Api(value="PACES接口", tags={"[CQZD]PACES接口"})
@Controller
@RequestMapping("cqzd/do/Paces")
public class PacsInterfaceController extends CqzdBaseController {
    private final PacsInterfaceService service;
    @Autowired
    public PacsInterfaceController(@Qualifier("PacesInterfaceServiceImpl") PacsInterfaceService service) {
        super(service, LogManager.getLogger(PacsInterfaceService.class));
        this.service = service;
    }

    /**
     * 获取PACS内容
     * @return
     */
    @ApiOperation(value="获取PACS",notes = "产前诊断系统")
    @ApiImplicitParams({@ApiImplicitParam(name = "outpatientNo", value = "outpatientNo",example = "1",required = true, dataTypeClass = String.class),
                        @ApiImplicitParam(name = "dict", value = "dict",example = "数字",required = false, dataTypeClass = String.class)
    })
        @GetMapping(value = {"/get/{outpatientNo}/{dict}","/get/{outpatientNo}"}, produces= PRODUCE_UTF8_JSON)
    @ResponseBody
    public List<PacsModel> get(@PathVariable String outpatientNo,@PathVariable(required = false)Integer dict){
        return service.getPaces(outpatientNo, dict);
    }
}
